import an7 from '@dfeidao/fd-an000007';
import an82 from '@dfeidao/fd-an000082';
import { IncomingHttpHeaders } from 'http';

interface Message {
	sort: 'asc' | 'desc';
}

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders): Promise<an82> {
	an7('Service begin path:pg001/zj-001/s001,action_id:' + action_id);
	const data = ['feidao', 'daoke'].sort((a, b) => {
		if (a === b) {
			return 0;
		}
		if (message.sort === 'desc') {
			return a < b ? 1 : -1;
		} else {
			return a > b ? 1 : -1;
		}
	})
	an7('Service end path:pg001/zj-001/s001,action_id:' + action_id);
	return {
		data
	} as an82;
}
